using System;
using System.Collections.Generic;
using System.Text;

namespace SharePointSearchBench.Library.Logging
{
    /// <summary>
    /// Used for writing warning messages to a log.  
    /// </summary>
    public class DisposableWarnLogWriter : IDisposableLogWriter
    {
        /// <summary>
        /// Creates a new instance of the class.
        /// </summary>
        public DisposableWarnLogWriter()
        {
            WarnLogWriter.WriteMessageInternal("");           
        }

        /// <summary>
        /// Creates a new instance of the class.
        /// </summary>
        /// <param name="message"></param>
        public DisposableWarnLogWriter(string message)
        {
            WarnLogWriter.WriteMessageInternal(string.Format("BEGIN: {0}", message));
        }

        /// <summary>
        /// Writes a warning message to a log.
        /// </summary>
        /// <param name="message"></param>
        public void WriteMessage(string message)
        {
            WarnLogWriter.WriteMessageInternal(message);
        }

        /// <summary>
        /// Disposes the object.
        /// </summary>
        public void Dispose()
        {
            WarnLogWriter.WriteMessageInternal("END");
        }
    }
}
